package com.igda.tihbms.data;

import com.igda.tihbms.controllers.ImagesController;

import android.graphics.Canvas;

public abstract class GameObject {

	protected Sprite sprite;
	protected boolean visible;
	protected boolean dead;

	protected float posX;
	protected float posY;

	public GameObject(float posX, float posY) {
		this.posX = posX;
		this.posY = posY;

		this.visible = true;
		this.dead = false;
	}

	public GameObject(float posX, float posY, Sprite sprite) {
		this(posX, posY);
		this.sprite = sprite;
	}

	public float getPosX() {
		return posX;
	}

	public float getPosY() {
		return posY;
	}

	public void setPosX(float posX) {
		this.posX = posX;
	}

	public void setPosY(float posY) {
		this.posY = posY;
	}

	public void updateLocation(float posX, float posY) {
		this.posX = posX;
		this.posY = posY;
	}

	public void moveX(float dx) {
		this.posX += dx;
	}

	public void moveY(float dy) {
		this.posY += dy;
	}

	public void moveXY(float dx, float dy) {
		this.posX += dx;
		this.posY += dy;
	}

	public void draw(Canvas canvas) {
		this.sprite.draw(canvas, this.posX, this.posY);
	}

	public boolean isDead() {
		return dead;
	}

	public boolean isVisible() {
		return visible;
	}

	public abstract void tick();
}
